package cn.inno.controller;

import cn.inno.service.DeptService;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/dept")
@RestController
public class DeptController extends BaseController {

    @Autowired
    private DeptService deptService;

    @GetMapping("/list")
    public String list() {
        JSONObject jsonObject = null;
        try {
            jsonObject = this.deptService.list();
        } catch (Exception e) {
            this.writeExceptionJson(jsonObject, e);
        }
        return this.writeJson(jsonObject);
    }

}
